<template>
  <div class="home-list">
    <van-card
      v-for="ll in lessonList"
      :key="ll.id"
      :price="ll.price"
      :title="ll.title"
      :thumb="ll.poster"
    >
      <template #tags>
        <van-tag plain type="danger">{{ formatCategory(ll.category) }}</van-tag>
      </template>
    </van-card>
  </div>
</template>

<script lang="ts">
import { ILesson, ILessons } from '@/typings/home';
import { defineComponent, PropType } from 'vue';

export default defineComponent({
  name: 'HomeList',
  components: {
    
  },
  props: {
    lessonList: {
      type: Array as PropType<ILesson[]>
    }
  },
  setup() {
    function formatCategory(type: number) {
      switch (type) {
        case 1:
          return 'react课程';
        case 2:
          return 'vue课程';
      }
    };

    return {
      formatCategory
    }
  }
});
</script>
